<template>
	<view class="agreement-page">
		<scroll-view class="agreement-content" scroll-y="true">
			<rich-text :nodes="agreementContent"></rich-text>
		</scroll-view>
	</view>
</template>

<script>
import { request, initBaseUrl, getFullImageUrl } from '../../../../utils/request';
export default {
	data() {
		return {
			agreementContent: ''
		};
	},
	onLoad() {
		
		this.getAgreementContent();
	},
	methods: {
		async getAgreementContent() {
			try {
				// 调用实际API获取用户协议内容
				const termsResponse = await request({
					url: '/Agreement/terms',
					method: 'POST'
				});
				// console.log('termsResponse', termsResponse);
				// 假设接口返回的数据结构为 { data: '协议HTML内容' }
				this.agreementContent = termsResponse.data.content;
			} catch (error) {
				console.error('获取用户协议失败:', error);
				// 错误处理：可以显示默认协议内容或错误提示
				this.agreementContent = '<p>获取协议内容失败，请稍后重试</p>';
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.agreement-page {
	background-color: #F2F3F8;
	height: 100vh;
	padding: 32rpx;

	.agreement-header {
		padding: 36rpx;
		border-bottom: 2rpx solid #f0f0f0;

		.agreement-title {
			font-size: 36rpx;
			font-weight: bold;
			color: #333;
		}
	}

	uni-scroll-view,
	wx-scroll-view {
		width: 588rpx;
	}

	.agreement-content {
		flex: 1;
		padding: 48rpx;
		background-color: #FFFFFF;
		border-radius: 35rpx;
		box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.05);

		/* 可选：添加轻微阴影增强立体感 */
		p {
			line-height: 1.8;
			margin-bottom: 32rpx;
		}

		h1 {
			font-size: 32rpx;
			font-weight: bold;
			margin: 32rpx 0;
		}
	}
}
</style>